Julia’s operator landscape is designed to mirror mathematical notation, bridging the gap between formal mathematics and high-performance computing through a rich set of ASCII and Unicode symbols.
1. Arithmetic Foundations
Beyond standard binary operators, Julia provides unary forms ($+x, -x$) and specialized division. Notable features include the inverse divide ($x \backslash y$), which is equivalent to $y / x$, and the remainder operator ($x \% y$), equivalent to rem(x,y).
- $+x, -x$ (Unary)
- $x + y, x - y, x * y$
- $x / y$ (Divide)
- $x \div y$ (Integer Divide)
- $x \backslash y$ (Inverse)
- $x ^ y$ (Power)
- $x \% y$ (Remainder)
- $\sim x$ (Bitwise NOT)
- $x \& y$ (AND)
- $x | y$ (OR)
- $x \veebar y$ (XOR / ⊻)
- $x >>> y$ (Logical Shift)
- $x >> y$ (Arithmetic Shift)
- $x << y$ (Left Shift)
2. Precision and Types
Logical negation !x is strictly for Booleans, while the tilde ($\sim$) serves as the bitwise NOT for integers. A critical nuance is type-awareness; applying $\sim$ to a UInt8 vs. a UInt32 yields different hexadecimal results because operations are performed on the specific bit-width of the underlying type.